/*
* PollutantService.java
* Created on  202015/6/15 17:09
* 版本       修改时间          作者      修改内容
* V1.0.1    202015/6/15       longshihui    初始版本
*
*/

package com.infitecs.eyas.combustion.service;

import com.infitecs.eyas.combustion.dao.PollutantDao;
import com.infitecs.eyas.combustion.model.CalculatePollution;
import com.infitecs.eyas.constant.Constant;
import com.infitecs.eyas.session.SessionService;
import com.infitecs.eyas.session.model.Param;
import com.infitecs.eyas.step.modal.StepInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 类的描述信息
 *
 * @author longshihui
 * @version 1.0.1
 */
@Service
public class PollutantService {
    @Autowired
    private PollutantDao pollutantDao;

    @Autowired
    private SessionService sessionService;

    public CalculatePollution getCalculatePollution() {
        return pollutantDao.getCalculatePollution(sessionService.getCaseId());
    }

    public void addCalculatePollution() {
        int caseId = sessionService.getCaseId();
        pollutantDao.addCalculatePollution(caseId);
        sessionService.addStepState(new StepInfo(caseId, Constant.STEP_ID_7, Constant.STEP_OVER_STATE_0));
    }

    public void saveValueOfPollutant(CalculatePollution calculatePollution) {
        calculatePollution.setCaseId(sessionService.getCaseId());
        pollutantDao.saveValueOfPollutant(calculatePollution);
        calculatePollution.setParamName(sessionService.getE() + calculatePollution.getParamName());
        sessionService.putParamMap(calculatePollution);
    }

    public void saveVo(CalculatePollution calculatePollution) {
        calculatePollution.setCaseId(sessionService.getCaseId());
        pollutantDao.saveVo(calculatePollution);
    }

}
